package com.jhgk.jhcee.system.handle;

import com.jhgk.jhcee.common.exception.ParamException;
import com.jhgk.jhcee.common.exception.ResultfulException;
import com.jhgk.jhcee.common.exception.UserException;
import com.jhgk.jhcee.common.resultful.BasisResultful;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

/**
 * @Description:
 * @Author: lemon_xzp
 * @Date: 2021/9/18 1:20
 */
@RestControllerAdvice
public class SystemExceptionHandle {

    @ExceptionHandler(UserException.class)
    public BasisResultful<Object> userHandle(UserException e) {
        e.printStackTrace();
        return BasisResultful.fail(e.getMessage());
    }

    @ExceptionHandler(ParamException.class)
    public BasisResultful<Object> paramHandle(ParamException e) {
        e.printStackTrace();
        return BasisResultful.fail(e.getMessage());
    }

    @ExceptionHandler(ResultfulException.class)
    public BasisResultful<Object> resultfulHandle(ResultfulException e) {
        e.printStackTrace();
        return BasisResultful.fail(e.getMessage());
    }

}
